package com.anjubao.parking.municipal.roadside.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhangyunbo
 * @date 2019/6/26 14:18
 */
@Getter
@AllArgsConstructor
public enum PayTypeEnum {
    IsNotSpecified(0, "未指定"),
    BePaidInAdvance(1, "预缴"),
    PaymentOf(2, "补缴"),
    AfterPaying(3, "后缴");

    private Integer code;

    private String desc;

    public static String getDescByCode(Integer code) {
        for (PayTypeEnum e : PayTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static Boolean exist(Integer code) {
        for (PayTypeEnum e : PayTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
}